

(defmacro while (test &body body)
  `(do
    ()
    ((not ,test))
     ,@body ))

(defun prime-p (number)
  (loop for i from 2 to (isqrt number) never (zerop (mod number i))))

(defun find-next-prime (number)
  (loop for num from (+ 1 number) when (prime-p num) return num))
 
(defun fen(num )
  (let ((zi 2)
	(number num))
    (while ( <=  zi  (/ num 2) )
      (if (= (mod number zi) 0) 
	  (progn 
	    (format t "~d ^ ~d ~%" zi (chai number zi 1))
	    (setf number (/ number (pow zi (chai number zi 1)))))
      (setf zi (find-next-prime zi))))))
	       
(defun chai (n a  count)
  (if (not (= (mod n (pow a count )) 0 ))
      (-  count 1)
      (chai n a (+ count 1)))))

(defun pow (num count )
  (if (= count 1)
      num 
      (pow (+ num num) (- count 1))))

(defun prime-mul-n (n) 
  (let ((fir 2)
	(pr ()))
    (while (< fir n)
      (setf pr (append pr (cons fir nil)))
      (setq fir (find-next-prime fir)))
    (reduce #'* pr)))

(defun mul-prime-p (n)
  (let ((number (prime-mul-n n)))
    (format t " number :2*3*5..~d =  ~d ~s~%" n (+  number 1) (prime-p (incf number)))))

(defun Format-p (f)
  (if (= (mod (pow 2 (- f 1)) f) 1)
      T))
